package com.achievement.controller;

import com.achievement.domain.param.AllAchievementParam;
import com.achievement.domain.vo.AllAchievementVO;
import com.achievement.service.IAllAchievementService;
import com.common.annotation.Anonymous;
import com.common.core.controller.BaseController;
import com.common.core.domain.AjaxResult;
import com.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/achievement/all")
@Api(tags = "成果管理模块---所有成果")
public class AllAchievementController extends BaseController {
    @Autowired
    private IAllAchievementService allAchievementService;


    @PreAuthorize("@ss.hasPermi('achievement:all:page')")
    @GetMapping("/page")
    @ApiOperation(value = "分页获取个人所有成果列表", notes = "分页获取个人所有成果列表")
    public TableDataInfo list(AllAchievementParam param) {
        startPage();
        List<AllAchievementVO> list = allAchievementService.selectByPage(param);
        return getDataTable(list);
    }

    @GetMapping("/group")
    @ApiOperation(value = "个人所有成果分组统计", notes = "个人所有成果分组统计")
    public AjaxResult group() {
        Map<String, Object> list = allAchievementService.group();
        return success(list);
    }
}
